package com.om39a.ds;

public class InsersionSort {
	public static void main(String[] args) {

		int[] val = { 6, 4, 3, 2, 7, 5, 1, 0, 8 };
		int length = val.length - 1;

		for (int i = 0; i < length; i++) {
			System.out.println("Initiating round " + i);
			for (int gg : val) {
				System.out.print(gg + " ");
			}
			for (int j = i; j > 0; j--) {
				int a = val[j - 1];
				int b = val[j];
				if (b <= a) {
					val[j - 1] = b;
					val[j] = a;
				}
			}
			System.out.println();
			for (int gg : val) {
				System.out.print(gg + " ");
			}
			System.out.println();
		}

	}
}
